package mario;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class StaticValue {
    //将图片加载到内存中
    //背景
    public static BufferedImage bg1 = null;
    public static BufferedImage bg2 = null;
    public static BufferedImage bg3 = null;
    public static BufferedImage bg4 = null;
    //洞
    public static BufferedImage imgpng = null;
    //开始
    public static BufferedImage start = null;
    //马里奥左站立
    public static BufferedImage stand_L = null;
    //马里奥右站立
    public static BufferedImage stand_R = null;
    //马里奥左跳跃
    public static BufferedImage jump_L = null;
    //马里奥右跳跃
    public static BufferedImage jump_R = null;
    //马里奥左跑
    public static List<BufferedImage> run_L = new ArrayList<>();
    //马里奥右跑d
    public static List<BufferedImage> run_R = new ArrayList<>();
    //障碍物
    public static List<BufferedImage> obstacle = new ArrayList<>();
    //蘑菇
    public static List<BufferedImage> mushroom = new ArrayList<>();
    //食人花
    public static List<BufferedImage> corpse = new ArrayList<>();
    //路径
    public static String path = "D:\\JavaCode\\code\\game\\mario\\src\\images\\";
    //初始化
    public static void init(){

        try {
            //加载背景图片
            bg1 = ImageIO.read(new File(path+"背景1.jpg"));
            bg2 = ImageIO.read(new File(path+"firststageend.jpg"));

            //开始
            start = ImageIO.read(new File(path+"start.jpg"));
            //左站立
            stand_L = ImageIO.read(new File(path+"6.png"));
            //右站立
            stand_R = ImageIO.read(new File(path+"1.png"));
            //左跳跃
            jump_L = ImageIO.read(new File(path+"7.png"));
            //右跳跃
            jump_R = ImageIO.read(new File(path+"2.png"));
            //左跑
            //run_L.add(ImageIO.read(new File(path+"8.png")));
            run_L.add(ImageIO.read(new File(path+"10.png")));
            run_L.add(ImageIO.read(new File(path+"6.png")));
            //右跑
            //run_R.add(ImageIO.read(new File(path+"3.png")));
            run_R.add(ImageIO.read(new File(path+"5.png")));
            run_R.add(ImageIO.read(new File(path+"1.png")));
            //蘑菇
            mushroom.add(ImageIO.read(new File(path+"triangle1.png")));
            mushroom.add(ImageIO.read(new File(path+"triangle2.png")));
            mushroom.add(ImageIO.read(new File(path+"triangle3.png")));
            //食人花
            corpse.add(ImageIO.read(new File(path+"flower1.png")));
            corpse.add(ImageIO.read(new File(path+"flower2.png")));
            //障碍物
            for (int i = 1;i <= 12; i++){
                obstacle.add(ImageIO.read(new File(path+"ob"+i+".png")));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
